package com.xm9m.web.service.controller;


import com.salesmanager.core.modules.cache.Xm9mRedisTemplateSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by 123 on 2016/2/19.
 */
@RestController
public class TestController {
    private static final Logger logger = LoggerFactory.getLogger(TestController.class);

    @Resource
    private Xm9mRedisTemplateSupport redisTemplate;

    @Resource
    private JedisPool jedisPoolRead;


    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public Object test(HttpServletRequest request) throws Exception {

        Jedis jedis = null;
        try {
            jedis = jedisPoolRead.getResource();
            Object o = jedis.get("aa");
        } finally {
            if (jedisPoolRead != null){
                jedisPoolRead.returnResourceObject(jedis);
            }
        }


       return "hello word!";
    }
}
